#ifndef _ENTITY_H_
#define _ENTITY_H_

#include "engine.h"
#include "opengl/opengl_shader.h"
#include "opengl/opengl_buffer.h"
#include "opengl/opengl_texture.h"
#include "entity/object2D.h"

namespace engine
{
    /**
     * 基本图元
     */
    class Entity
    {

    public:
        Entity()
        {
            this->vertexArray = new VertexArray();
        }
        ~Entity()
        {
            delete this->vertexArray;
        }

    public:
        void render()
        {
            vertexArray->bind();
            // glDrawArrays(this->primitiveType, 0, vertexSize);
            glDrawElements(primitiveType, 6, GL_UNSIGNED_INT, 0);
        }

        void drawVertex();
        void drawIndex();

    protected:
        VertexArray *vertexArray;            //顶点数组
        GLsizei vertexSize;                  //顶点数量
        GLenum primitiveType = GL_TRIANGLES; //图元类型

    private:
    };

}
#endif